﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication13
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Choose the number of the program");
            int selection = Int32.Parse(Console.ReadLine());
            switch (selection)
            {
                case 1:
                    SquareNumbers();
                    break;
                case 2:
                    CountNumbers();
                    break;
                case 3:
                    PrintLineToConsole();
                    break;
                case 4:
                    CountNum();
                    break;
                case 5:
                    FindMax();
                    break;
                default:
                    Console.WriteLine("The number is incorrect");
                    break;
            }
        }


        static void SquareNumbers()
        {
            for (int number = 20; number >= 10; number--)
                if ((number >= 10) && (number <= 20))
                {
                    Console.WriteLine("Квадрат числа {0} равен {1}", number, number * number);
                }
        }

        static void CountNumbers()

        {

            for (int number = -99; number <= 99; number++)
                if ((number % 5 == 0) && ((number >= 10) && (number <= 99) || (number <= -10) && (number >= -99)))
                {
                    Console.WriteLine(number);
                }


        }

        static void CountNum()
        {
            Console.WriteLine("Enter number");
            int number = Int32.Parse(Console.ReadLine());
            int count = 1;
            int max = 0;
            int min = 9;
            int mid = 0;
            while (number / 10 > 0)
            {
                mid = number % 10;
                if (max < mid)
                    max = mid;
                if (mid < min)
                    min = mid;
                number /= 10;
                count++;
            }
            if (max < number)
                max = number;
            if (number < min)
                min = number;
            Console.WriteLine(count);
            Console.WriteLine(max);
            Console.WriteLine(min);
        }

        static void FindMax()
        { Console.WriteLine("Enter numbers");
           
            int max = Int32.MinValue;
            bool FirstIteration = true;

            for (int numbers=1; numbers<6 ; numbers++)
                       
            {
                int numbers = Int32.Parse(Console.ReadLine());
                if (FirstIteration)
                {
                    max = number;
                    FirstIteration = false;
                }
                else if (max < number)
                {
                    max = number;
                }
            }
            Console.WriteLine("Maximum value: " + max);
        }

    }

         static void PrintLineToConsole()
        {

            Console.WriteLine("введите количество чисел");
            int count = Int32.Parse(Console.ReadLine());

            int positivecount = 0;
            int negativecount = 0;
            int zerocount = 0;
            for (; count > 0; count--)
            {
                Console.WriteLine("введите число");
                int number = Int32.Parse(Console.ReadLine());

                if (number > 0)
                    positivecount++;
                else if (number < 0)
                    negativecount++;
                else if (number == 0)
                    zerocount++;
            }

            Console.WriteLine("Положительных {0}, отрицательных {1}, нулей {2}", positivecount, negativecount, zerocount);

        }





    }


